<%@ page language="java" isELIgnored="false" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp"/>
<fmt:setBundle basename="bundles.facultyresearch-resources"/>


<div id="mainBody">
<script type="text/javascript">
    var infoList_s;
  	var num_of_arts;
  	var ipp;

  	function handlePaginationClick(new_page_index, pagination_container) {
  	    var pc = $(pagination_container);
  	    pc.children('div.infoList').remove();
  	 	pc.append('<br/><br/>')
  	 	var paginationClone = $("#Pagination > *").clone(true);
        $("#Pagination2").empty();
        paginationClone.appendTo("#Pagination2");
  	    for(var i=new_page_index*ipp; i < (new_page_index+1)*ipp ;i++) {
  	        if (i < num_of_arts) {
  	                pc.append(infoList_s[i]);
  	        }
  	    }

  	    return false;
  	}

  	$(document).ready(function() {
  		infoList_s = $('div.infoList').remove();
  	    num_of_arts = infoList_s.length;
  	    ipp = 5;

  	    // First Parameter: number of items
  	    // Second Parameter: options object
  	    $("#Pagination").pagination(num_of_arts, {
  	        items_per_page:ipp, 
  	        callback:handlePaginationClick
  	    });
  	}); 
  	

	</script> 
	<div class="title"><security:authorize ifAllGranted="ROLE_ADMIN">Manage</security:authorize> <fmt:message key="facultyresearch.title"/></div>
    	<form id="searchForm" action="search.html" method="post">
        <div id="search">
            <div id="searchBox">
                <textarea id="searchTerm" name="searchTerm" rows="1">${searchTerm}</textarea><button type="submit" id="goButton">GO</button>
          	</div>
      		<div id="searchOptions">
                <div>
                    <input class="advSearch thesis" type="checkbox" name="thesis" value="yes" /> Theses
                    <input class="advSearch facResearch" type="checkbox" name="research" value="yes" checked /> Faculty Research
                </div>
          	</div>
        </div>
        </form>
	<security:authorize ifNotGranted="ROLE_ADMIN">
	
  	<%-- <div id="body">
  		<div class="cats">
        	<div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
            <div><a href="index.html">Category</a></div>
        </div>--%>
    	<div>
        	
            <c:forEach items="${facultyresearchs }" var="research">
            <div class="infoList">
            	<div class="link"><a href="${pageContext.request.contextPath}/selectFacultyresearch.html?facultyResearchIdKey=${research.facultyResearchId }">${research.title }</a></div>
                <div class="abs"><p>${research.researchDescription }</p></div>
                <div class="props">
                	<div><a href="searchFacultyresearchByFacultyId.html?id=${research.faculty.facultyId }">${research.faculty.firstName } ${research.faculty.lastName }</a></div>
                	<div><c:forEach items="${research.facultyresearchtostudents }" var="frs">
                		<a href="searchFacultyresearchByStudentId.html?id=${frs.student.studentId }">${frs.student.firstName } ${frs.student.lastName }</a>
                	</c:forEach></div>
                	<div><a href="searchFacultyresearchByStatus.html?status=${research.researchStatus }">${research.researchStatus }</a></div>
                	
                </div>
            </div>
            </c:forEach>
        </div>
    </div>
    <div id="Pagination"> </div>
    <div id="Paginationcontent"> </div>
    <div id="Pagination2"> </div>
    </security:authorize>
  
  <security:authorize ifAllGranted="ROLE_ADMIN">
  	<div class="navitem"><a class="button" href="${pageContext.request.contextPath}/newFacultyresearch"><span><img src="${pageContext.request.contextPath}/includes/images/icons/new.gif" /><fmt:message key="navigation.new"/> <fmt:message key="facultyresearch.title"/></span></a></div>
	<div id="body">
    	<div id="table">
        	<div class="header">
                <div>&nbsp;</div>
                <div>Title</div>
                <div>Status</div>
                <div>Minimum Requirements</div>
            </div>
            <c:forEach items="${facultyresearchs}" var="current">
            <div class="row">
            	<div>
            		<a title="<fmt:message key="navigation.view" />" href="${pageContext.request.contextPath}/selectFacultyresearch?facultyResearchIdKey=${current.facultyResearchId}&"><img src="includes/images/icons/view.gif" /></a>
						<a title="<fmt:message key="navigation.edit" />" href="${pageContext.request.contextPath}/editFacultyresearch?facultyResearchIdKey=${current.facultyResearchId}&"><img src="includes/images/icons/edit.gif" /></a>
						<a title="<fmt:message key="navigation.delete" />" href="${pageContext.request.contextPath}/confirmDeleteFacultyresearch?facultyResearchIdKey=${current.facultyResearchId}&"><img src="includes/images/icons/delete.gif" /></a>
            	</div>
            	<div>${current.title}</div>
            	<div>${current.researchStatus}</div>
            	<div>${current.minumumRequirements}</div>
            </div>
            </c:forEach>
        </div>
        
	</div>
	</security:authorize>
</div>
  